/**
 * 依赖包：jquery.min.js、jquery.eui.min.js、etb-collection.js
 */
$.extend($.fn.tree.methods, {
	/**
	 * 删除选中项
	 */
    deleteSelected : function(jq, param) {
        var tree = $(jq);
        var selected = tree.tree("getSelected");
        var json = {ids: selected.id};
        $.messager.confirm('提示', '你确定要删除选中项？', function(result){
    		if(result) {
    			var parent = tree.tree('getParent',selected.target);
    			if(parent) {
    				tree.tree('select',parent.target);
    			}
    			ajax({
    				url:param.url, 
    				data:json, 
    				success:function() {
    					if(param.success) {
    						param.success(parent);
    					}
    					if(parent) {
    						tree.tree('reload',parent.target);
    					} else {
    						tree.tree('reload');
    					}
    				}
    			});
    		}
    	});
    }
});